package com.coai.rtc.dto

import com.coai.rtc.model.*
import java.time.LocalDateTime

/**
 * 发起通话请求
 */
data class InitiateCallRequest(
    val conversationId: String,
    val callType: CallType,
    val mediaType: MediaType,
    val participantIds: List<String>? = null // 群组通话时需要
)

/**
 * 通话响应DTO
 */
data class CallDto(
    val id: String,
    val callType: CallType,
    val mediaType: MediaType,
    val callerId: String,
    val callerName: String?,
    val conversationId: String,
    val status: CallStatus,
    val participants: List<ParticipantDto>,
    val startTime: LocalDateTime?,
    val endTime: LocalDateTime?,
    val duration: Long?,
    val recordingUrl: String?,
    val transcriptUrl: String?,
    val analysisUrl: String?,
    val createdAt: LocalDateTime
)

/**
 * 参与者DTO
 */
data class ParticipantDto(
    val id: String,
    val userId: String,
    val userName: String?,
    val userAvatar: String?,
    val status: ParticipantStatus,
    val joinedAt: LocalDateTime?,
    val leftAt: LocalDateTime?,
    val muted: Boolean,
    val videoEnabled: Boolean,
    val screenSharing: Boolean
)

/**
 * 通话列表响应
 */
data class CallListResponse(
    val calls: List<CallDto>,
    val hasMore: Boolean,
    val total: Long
)

/**
 * 接受/拒绝通话请求
 */
data class CallResponseRequest(
    val accept: Boolean
)

/**
 * 更新媒体状态请求
 */
data class UpdateMediaStateRequest(
    val muted: Boolean? = null,
    val videoEnabled: Boolean? = null,
    val screenSharing: Boolean? = null
)

/**
 * 通话统计
 */
data class CallStatistics(
    val totalCalls: Long,
    val totalDuration: Long, // 总时长（秒）
    val averageDuration: Double,
    val audioCallCount: Long,
    val videoCallCount: Long,
    val missedCallCount: Long,
    val callsByDay: Map<String, Long>
)
